<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/NumbTh.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">NumbTh.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_numb_th_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_NUMBTH_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_NUMBTH_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;set&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#include &lt;complex&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;climits&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;istream&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;ctime&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;NTL/version.h&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZ.h&gt;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZX.h&gt;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZ_p.h&gt;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &lt;NTL/ZZ_pX.h&gt;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#include &lt;NTL/xdouble.h&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#include &lt;NTL/mat_GF2.h&gt;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#include &lt;NTL/mat_GF2E.h&gt;</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="preprocessor">#include &lt;NTL/GF2XFactoring.h&gt;</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">#include &lt;NTL/mat_lzz_p.h&gt;</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#include &lt;NTL/mat_lzz_pE.h&gt;</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">#include &lt;NTL/lzz_pXFactoring.h&gt;</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160; </div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#include &lt;NTL/GF2EX.h&gt;</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#include &lt;NTL/lzz_pEX.h&gt;</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#include &lt;NTL/FFT.h&gt;</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">// Test for the &quot;right version&quot; of NTL (currently 11.0.0)</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="preprocessor">#if (NTL_MAJOR_VERSION &lt; 11)</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="preprocessor">#error &quot;This version of HElib requires NTL version 11.0.0 or above&quot;</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="range_8h.html">helib/range.h</a>&gt;</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="assertions_8h.html">helib/assertions.h</a>&gt;</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="api_attributes_8h.html">helib/apiAttributes.h</a>&gt;</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">long</span> <span class="keywordtype">double</span> <a class="code" href="namespacehelib.html#aa4e11abf6db9206e9dc7ac9397ce28fb">PI</a>;</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="namespacehelib_1_1_f_h_eglobals.html">   66</a></span>&#160;<span class="keyword">namespace </span>FHEglobals {</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a59a5014a165318cfdf6dd1ba9044e9e3">dryRun</a>;</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160; </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="keyword">extern</span> std::set&lt;long&gt;* <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#ae595d95a946a3f9b5bfbac55e5f0df0f">automorphVals</a>;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="keyword">extern</span> std::set&lt;long&gt;* <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a26e09dcf2db94c4039eb189a76a803ee">automorphVals2</a>;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;} <span class="comment">// namespace FHEglobals</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="namespacehelib.html#af8f51eef1d124d7e046b6a276d857fdb">   83</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#af8f51eef1d124d7e046b6a276d857fdb">setDryRun</a>(<span class="keywordtype">bool</span> toWhat = <span class="keyword">true</span>)</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;{</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keywordflow">return</span> (<a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a59a5014a165318cfdf6dd1ba9044e9e3">FHEglobals::dryRun</a> = toWhat);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;}</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160; </div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="namespacehelib.html#aa79a0a06add60a27a1a2198fcf948e01">   88</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#aa79a0a06add60a27a1a2198fcf948e01">isDryRun</a>() { <span class="keywordflow">return</span> <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a59a5014a165318cfdf6dd1ba9044e9e3">FHEglobals::dryRun</a>; }</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="namespacehelib.html#a1ce92a7a0f311e90d9022ea931a671ec">   90</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a1ce92a7a0f311e90d9022ea931a671ec">setAutomorphVals</a>(std::set&lt;long&gt;* aVals)</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#ae595d95a946a3f9b5bfbac55e5f0df0f">FHEglobals::automorphVals</a> = aVals;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;}</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="namespacehelib.html#ac639ce6687180f2ac5e50e8706d79488">   95</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#ac639ce6687180f2ac5e50e8706d79488">isSetAutomorphVals</a>()</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;{</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#ae595d95a946a3f9b5bfbac55e5f0df0f">FHEglobals::automorphVals</a> != <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;}</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="namespacehelib.html#a7b0cf6b325974c5fb87c29686d82e414">  100</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7b0cf6b325974c5fb87c29686d82e414">recordAutomorphVal</a>(<span class="keywordtype">long</span> k) { <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#ae595d95a946a3f9b5bfbac55e5f0df0f">FHEglobals::automorphVals</a>-&gt;insert(k); }</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="namespacehelib.html#a8fab1809e50aa6fc8c0f80e66943f490">  102</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8fab1809e50aa6fc8c0f80e66943f490">setAutomorphVals2</a>(std::set&lt;long&gt;* aVals)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;{</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;  <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a26e09dcf2db94c4039eb189a76a803ee">FHEglobals::automorphVals2</a> = aVals;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;}</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="namespacehelib.html#aff7fd713547b09f8f18fbf95ccf83f95">  107</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#aff7fd713547b09f8f18fbf95ccf83f95">isSetAutomorphVals2</a>()</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;{</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="keywordflow">return</span> <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a26e09dcf2db94c4039eb189a76a803ee">FHEglobals::automorphVals2</a> != <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;}</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160; </div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="namespacehelib.html#a479ecb7208f177739fa83913e8515192">  112</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a479ecb7208f177739fa83913e8515192">recordAutomorphVal2</a>(<span class="keywordtype">long</span> k)</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;{</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  <a class="code" href="namespacehelib_1_1_f_h_eglobals.html#a26e09dcf2db94c4039eb189a76a803ee">FHEglobals::automorphVals2</a>-&gt;insert(k);</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;}</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad6eb9f0889a704dbc4684ce445c48456">  117</a></span>&#160;<span class="keyword">typedef</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ad6eb9f0889a704dbc4684ce445c48456">LONG</a>; <span class="comment">// using this to identify casts that we should</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;                   <span class="comment">// really get rid of at some point in the future</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#af6cd0b7c9b7fa0afbb885295f10d9354">bitSetToLong</a>(<span class="keywordtype">long</span> bits, <span class="keywordtype">long</span> bitSize);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160; </div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a3f2638750d81a618d59217f3e9b3218a">mcMod</a>(<span class="keywordtype">long</span> a, <span class="keywordtype">long</span> b);</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a51f60e27cb24d575d4b10a522dbb4279">mcDiv</a>(<span class="keywordtype">long</span> a, <span class="keywordtype">long</span> b);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="namespacehelib.html#af183ee91810e5601837e62dfb85df0cd">  141</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#af183ee91810e5601837e62dfb85df0cd">balRem</a>(<span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q)</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;{</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;  <span class="keywordflow">if</span> (a &gt; q / 2)</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="keywordflow">return</span> a - q;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordflow">return</span> a;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;}</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad92538fab792f75e009a2330c365637d">  150</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespacehelib.html#ad92538fab792f75e009a2330c365637d">fsquare</a>(<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> x * x; }</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a96fc760be384a17313e24f5383ceabd1">multOrd</a>(<span class="keywordtype">long</span> p, <span class="keywordtype">long</span> m);</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acdb8f2124f5f56970fe7f88802c976b1">ppsolve</a>(NTL::vec_zz_pE&amp; x,</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;             <span class="keyword">const</span> NTL::mat_zz_pE&amp; A,</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;             <span class="keyword">const</span> NTL::vec_zz_pE&amp; b,</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;             <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;             <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160; </div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#acdb8f2124f5f56970fe7f88802c976b1">ppsolve</a>(NTL::vec_GF2E&amp; x,</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;             <span class="keyword">const</span> NTL::mat_GF2E&amp; A,</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;             <span class="keyword">const</span> NTL::vec_GF2E&amp; b,</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;             <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;             <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a784e87216f278000cfa935b61657da58">ppInvert</a>(NTL::mat_zz_p&amp; X, <span class="keyword">const</span> NTL::mat_zz_p&amp; A, <span class="keywordtype">long</span> p, <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a784e87216f278000cfa935b61657da58">ppInvert</a>(NTL::mat_zz_pE&amp; X, <span class="keyword">const</span> NTL::mat_zz_pE&amp; A, <span class="keywordtype">long</span> p, <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160; </div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="comment">// variants for GF2/GF2E to help with template code</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="line" href="namespacehelib.html#af35b575565f163995c6abd08972bddf2">  185</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a784e87216f278000cfa935b61657da58">ppInvert</a>(NTL::mat_GF2&amp; X,</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;                     <span class="keyword">const</span> NTL::mat_GF2&amp; A,</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                     <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                     <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> r)</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;{</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  NTL::inv(X, A);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;}</div>
<div class="line"><a name="l00192"></a><span class="lineno"><a class="line" href="namespacehelib.html#ac46606ccee8c1fe481e3b5a1f90291c5">  192</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a784e87216f278000cfa935b61657da58">ppInvert</a>(NTL::mat_GF2E&amp; X,</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                     <span class="keyword">const</span> NTL::mat_GF2E&amp; A,</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;                     <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                     <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> r)</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;{</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;  NTL::inv(X, A);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;}</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160; </div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7db28e5ca105b114e0c89655eee171b9">buildLinPolyMatrix</a>(NTL::mat_zz_pE&amp; M, <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7db28e5ca105b114e0c89655eee171b9">buildLinPolyMatrix</a>(NTL::mat_GF2E&amp; M, <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a5711dacd10c102835bd585bff52e32c5">buildLinPolyCoeffs</a>(NTL::vec_zz_pE&amp; C,</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;                        <span class="keyword">const</span> NTL::vec_zz_pE&amp; L,</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;                        <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;                        <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160; </div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a5711dacd10c102835bd585bff52e32c5">buildLinPolyCoeffs</a>(NTL::vec_GF2E&amp; C,</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;                        <span class="keyword">const</span> NTL::vec_GF2E&amp; L,</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;                        <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;                        <span class="keywordtype">long</span> r);</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160; </div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0dda3f81ff66fb0e9a92bc39ecad0a92">applyLinPoly</a>(NTL::zz_pE&amp; beta,</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;                  <span class="keyword">const</span> NTL::vec_zz_pE&amp; C,</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;                  <span class="keyword">const</span> NTL::zz_pE&amp; alpha,</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                  <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160; </div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0dda3f81ff66fb0e9a92bc39ecad0a92">applyLinPoly</a>(NTL::GF2E&amp; beta,</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;                  <span class="keyword">const</span> NTL::vec_GF2E&amp; C,</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;                  <span class="keyword">const</span> NTL::GF2E&amp; alpha,</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;                  <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160; </div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="line" href="namespacehelib.html#ac1630d15e5b8352685afcf561db40323">  237</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespacehelib.html#ac1630d15e5b8352685afcf561db40323">log2</a>(<span class="keyword">const</span> NTL::xdouble&amp; x) { <span class="keywordflow">return</span> log(x) * 1.442695040889; }</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160; </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8d163aa9f73ad476ebd97d7778d79258">factorize</a>(std::vector&lt;long&gt;&amp; factors, <span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8d163aa9f73ad476ebd97d7778d79258">factorize</a>(std::vector&lt;NTL::ZZ&gt;&amp; factors, <span class="keyword">const</span> NTL::ZZ&amp; N);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160; </div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8d163aa9f73ad476ebd97d7778d79258">factorize</a>(NTL::Vec&lt;NTL::Pair&lt;long, long&gt;&gt;&amp; factors, <span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160; </div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a407ad6533d4dd3820cc35b07ad41988b">pp_factorize</a>(std::vector&lt;long&gt;&amp; factors, <span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160; </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">phiN</a>(<span class="keywordtype">long</span>&amp; <a class="code" href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">phiN</a>, std::vector&lt;long&gt;&amp; facts, <span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">phiN</a>(NTL::ZZ&amp; <a class="code" href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">phiN</a>, std::vector&lt;NTL::ZZ&gt;&amp; facts, <span class="keyword">const</span> NTL::ZZ&amp; N);</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160; </div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a93e575c4502d7606d86b46af66600ce0">phi_N</a>(<span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160; </div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a67f0037687252f6999a8526165cd8e41">findGenerators</a>(std::vector&lt;long&gt;&amp; gens,</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;                    std::vector&lt;long&gt;&amp; ords,</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;                    <span class="keywordtype">long</span> m,</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;                    <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;                    <span class="keyword">const</span> std::vector&lt;long&gt;&amp; candidates = std::vector&lt;long&gt;());</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160; </div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e1f9936cf8c582202702cbb65eaf2ce">FindPrimitiveRoot</a>(NTL::zz_p&amp; r, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> e);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e1f9936cf8c582202702cbb65eaf2ce">FindPrimitiveRoot</a>(NTL::ZZ_p&amp; r, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> e);</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160; </div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ad4d98c1a6634ea3827fafd456ea56a5e">mobius</a>(<span class="keywordtype">long</span> n);</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160; </div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;NTL::ZZX <a class="code" href="namespacehelib.html#a181a74dc451ffc410450d6c238f2a68c">Cyclotomic</a>(<span class="keywordtype">long</span> N);</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160; </div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;NTL::ZZX <a class="code" href="namespacehelib.html#adad7e0c1723b324e29278f21aa889143">makeIrredPoly</a>(<span class="keywordtype">long</span> p, <span class="keywordtype">long</span> d);</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160; </div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a9b5c3e6a25c84bcec39b646e10598378">primroot</a>(<span class="keywordtype">long</span> N, <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">phiN</a>);</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160; </div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a8693a4a2d91babebc9b8887bbcd1f0ea">ord</a>(<span class="keywordtype">long</span> N, <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160; </div>
<div class="line"><a name="l00285"></a><span class="lineno"><a class="line" href="namespacehelib.html#a57dbaa8bc9cf194a1e08fd5af3497a5e">  285</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#a57dbaa8bc9cf194a1e08fd5af3497a5e">is2power</a>(<span class="keywordtype">long</span> m)</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;{</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;  <span class="keywordtype">long</span> k = NTL::NextPowerOfTwo(m);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;  <span class="keywordflow">return</span> (((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)m) == (1UL &lt;&lt; k));</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;}</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160; </div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="comment">// Returns a random mod p polynomial of degree &lt; n</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;NTL::ZZX <a class="code" href="namespacehelib.html#ad0bcd83ef1650a094f9ba12551a2e9e4">RandPoly</a>(<span class="keywordtype">long</span> n, <span class="keyword">const</span> NTL::ZZ&amp; p);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160; </div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160; </div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(NTL::ZZX&amp; out, <span class="keyword">const</span> NTL::ZZX&amp; in, <span class="keywordtype">long</span> q, <span class="keywordtype">bool</span> abs = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(NTL::ZZX&amp; out,</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;             <span class="keyword">const</span> NTL::ZZX&amp; in,</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;             <span class="keyword">const</span> NTL::ZZ&amp; q,</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;             <span class="keywordtype">bool</span> abs = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00306"></a><span class="lineno"><a class="line" href="namespacehelib.html#aec8847d93fff429651833026b9553e1b">  306</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(NTL::ZZX&amp; F, <span class="keywordtype">long</span> q, <span class="keywordtype">bool</span> abs = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;{</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;  <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(F, F, q, abs);</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;}</div>
<div class="line"><a name="l00310"></a><span class="lineno"><a class="line" href="namespacehelib.html#a7ada257cf26f3f2074300fddf5381f11">  310</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(NTL::ZZX&amp; F, <span class="keyword">const</span> NTL::ZZ&amp; q, <span class="keywordtype">bool</span> abs = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;{</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;  <a class="code" href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">PolyRed</a>(F, F, q, abs);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9bc3d452674c06b19349e1bfc47cd6bb">vecRed</a>(NTL::Vec&lt;NTL::ZZ&gt;&amp; out,</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;            <span class="keyword">const</span> NTL::Vec&lt;NTL::ZZ&gt;&amp; in,</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;            <span class="keywordtype">long</span> q,</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;            <span class="keywordtype">bool</span> abs);</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9bc3d452674c06b19349e1bfc47cd6bb">vecRed</a>(NTL::Vec&lt;NTL::ZZ&gt;&amp; out,</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;            <span class="keyword">const</span> NTL::Vec&lt;NTL::ZZ&gt;&amp; in,</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;            <span class="keyword">const</span> NTL::ZZ&amp; q,</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;            <span class="keywordtype">bool</span> abs);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160; </div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;<span class="comment">// The interface has changed so that abs defaults to false,</span></div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;<span class="comment">// which is more consistent with the other interfaces.</span></div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;<span class="comment">// Calls without any explicit value for abs should generate a</span></div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;<span class="comment">// &quot;deprecated&quot; warning.</span></div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160; </div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(NTL::ZZX&amp; out, <span class="keyword">const</span> NTL::ZZX&amp; f, <span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q, <span class="keywordtype">bool</span> abs);</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160; </div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;[[deprecated(<span class="stringliteral">&quot;Please use MulMod with explicit abs argument.&quot;</span>)]] <span class="keyword">inline</span> <span class="keywordtype">void</span></div>
<div class="line"><a name="l00332"></a><span class="lineno"><a class="line" href="namespacehelib.html#af73b2f08337ba65b54609e7bfca96cda">  332</a></span>&#160;<a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(NTL::ZZX&amp; out, <span class="keyword">const</span> NTL::ZZX&amp; f, <span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q)</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;{</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;  <a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(out, f, a, q, <span class="keyword">false</span>);</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;}</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160; </div>
<div class="line"><a name="l00337"></a><span class="lineno"><a class="line" href="namespacehelib.html#a44a8cf8d3d1da74a8060a177e3e49028">  337</a></span>&#160;<span class="keyword">inline</span> NTL::ZZX <a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(<span class="keyword">const</span> NTL::ZZX&amp; f, <span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q, <span class="keywordtype">bool</span> abs)</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;{</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;  NTL::ZZX res;</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;  <a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(res, f, a, q, abs);</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;  <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;}</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160; </div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;[[deprecated(<span class="stringliteral">&quot;Please use MulMod with explicit abs argument.&quot;</span>)]] <span class="keyword">inline</span> NTL::ZZX</div>
<div class="line"><a name="l00345"></a><span class="lineno"><a class="line" href="namespacehelib.html#a16376b83d0b9ac08d1cc631756741220">  345</a></span>&#160;<a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(<span class="keyword">const</span> NTL::ZZX&amp; f, <span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q)</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;{</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;  NTL::ZZX res;</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;  <a class="code" href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">MulMod</a>(res, f, a, q, <span class="keyword">false</span>);</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;  <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;}</div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160; </div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a00e504f2374c5e7357c7608a94527887">balanced_MulMod</a>(NTL::ZZX&amp; out, <span class="keyword">const</span> NTL::ZZX&amp; f, <span class="keywordtype">long</span> a, <span class="keywordtype">long</span> q);</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160; </div>
<div class="line"><a name="l00358"></a><span class="lineno"><a class="line" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">  358</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(<span class="keywordtype">long</span>&amp; x1, <span class="keyword">const</span> NTL::GF2X&amp; x2) { x1 = rep(ConstTerm(x2)); }</div>
<div class="line"><a name="l00359"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad7d74d8c1673da0da8d2d53a9f56f30a">  359</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(<span class="keywordtype">long</span>&amp; x1, <span class="keyword">const</span> NTL::zz_pX&amp; x2) { x1 = rep(ConstTerm(x2)); }</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::vec_zz_pE&amp; X, <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; A);</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::mat_zz_pE&amp; X, <span class="keyword">const</span> std::vector&lt;std::vector&lt;NTL::ZZX&gt;&gt;&amp; A);</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(std::vector&lt;NTL::ZZX&gt;&amp; X, <span class="keyword">const</span> NTL::vec_zz_pE&amp; A);</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(std::vector&lt;std::vector&lt;NTL::ZZX&gt;&gt;&amp; X, <span class="keyword">const</span> NTL::mat_zz_pE&amp; A);</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::Vec&lt;long&gt;&amp; out, <span class="keyword">const</span> NTL::ZZX&amp; in);</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::Vec&lt;long&gt;&amp; out, <span class="keyword">const</span> NTL::zz_pX&amp; in, <span class="keywordtype">bool</span> symmetric = <span class="keyword">true</span>);</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::Vec&lt;long&gt;&amp; out, <span class="keyword">const</span> NTL::GF2X&amp; in);</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::ZZX&amp; out, <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; in);</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::GF2X&amp; out, <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; in);</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="comment">// right now, this is just a place-holder...it may or may not</span></div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;<span class="comment">// eventually be further fleshed out</span></div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160; </div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160; </div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00376"></a><span class="lineno"><a class="line" href="namespacehelib.html#ab2e47ad408b14cf352174243c3c8adf6">  376</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(T1&amp; x1, <span class="keyword">const</span> T2&amp; x2)</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;{</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;  <a class="code" href="namespacehelib.html#af5a79c25bb9e1285c93b486ce07c4d52">NTL::conv</a>(x1, x2);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;}</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160; </div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00383"></a><span class="lineno"><a class="line" href="namespacehelib.html#a59e1e9edc58b546c8d12a4cb56812f81">  383</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(std::vector&lt;T1&gt;&amp; v1, <span class="keyword">const</span> std::vector&lt;T2&gt;&amp; v2)</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;{</div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;  <span class="keywordtype">long</span> n = v2.size();</div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;  v1.resize(n);</div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; n; i++)</div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v1[i], v2[i]);</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;}</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160; </div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00392"></a><span class="lineno"><a class="line" href="namespacehelib.html#ab5d8cacfd0370294ae07fb571ee2caee">  392</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(std::vector&lt;T1&gt;&amp; v1, <span class="keyword">const</span> NTL::Vec&lt;T2&gt;&amp; v2)</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;{</div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;  <span class="keywordtype">long</span> n = v2.length();</div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;  v1.resize(n);</div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; n; i++)</div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v1[i], v2[i]);</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;}</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160; </div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00401"></a><span class="lineno"><a class="line" href="namespacehelib.html#a33593bb6e050f5639138bf3f76a28d8c">  401</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(NTL::Vec&lt;T1&gt;&amp; v1, <span class="keyword">const</span> std::vector&lt;T2&gt;&amp; v2)</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;{</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;  <span class="keywordtype">long</span> n = v2.size();</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;  v1.SetLength(n);</div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; n; i++)</div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;    <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v1[i], v2[i]);</div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;}</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00411"></a><span class="lineno"><a class="line" href="namespacehelib.html#aa59b9ea3393970dcb1c4a9ef6ef310ef">  411</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(std::vector&lt;T&gt;&amp; v1, <span class="keyword">const</span> std::vector&lt;T&gt;&amp; v2)</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;{</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;  v1 = v2;</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;}</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160; </div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00417"></a><span class="lineno"><a class="line" href="namespacehelib.html#a194a7e93c41b4da649614c39e9a77c8f">  417</a></span>&#160;T1 <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(<span class="keyword">const</span> T2&amp; v2)</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;{</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;  T1 v1;</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;  <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v1, v2);</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;  <span class="keywordflow">return</span> v1;</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;}</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160; </div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00425"></a><span class="lineno"><a class="line" href="namespacehelib.html#a3f11bbe3deab00c9a1dc525d23958a6c">  425</a></span>&#160;std::vector&lt;T&gt; <a class="code" href="namespacehelib.html#a3f11bbe3deab00c9a1dc525d23958a6c">vector_replicate</a>(<span class="keyword">const</span> T&amp; a, <span class="keywordtype">long</span> n)</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;{</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;  std::vector&lt;T&gt; res;</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;  res.resize(n);</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; n; i++)</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;    res[i] = a;</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;  <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;}</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160; </div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00435"></a><span class="lineno"><a class="line" href="namespacehelib.html#a29ccc2648ee5736fe519c1c884bf1b68">  435</a></span>&#160;std::vector&lt;T&gt; <a class="code" href="namespacehelib.html#a29ccc2648ee5736fe519c1c884bf1b68">Vec_replicate</a>(<span class="keyword">const</span> T&amp; a, <span class="keywordtype">long</span> n)</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;{</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;  NTL::Vec&lt;T&gt; res;</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;  res.SetLength(n);</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; n; i++)</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;    res[i] = a;</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;  <span class="keywordflow">return</span> res;</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;}</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160; </div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a9837bdade0e2dabb7bbf0d03a5e2e93b">computeProd</a>(<span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; vec);</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a9837bdade0e2dabb7bbf0d03a5e2e93b">computeProd</a>(<span class="keyword">const</span> std::vector&lt;long&gt;&amp; vec);</div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160; </div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;<span class="comment">// some useful operations</span></div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0cfe07d1b0c2f0e6385f2b6525e0a69b">mul</a>(std::vector&lt;NTL::ZZX&gt;&amp; x, <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; a, <span class="keywordtype">long</span> b);</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9965244b44a7884f3e08999f6adec16f">div</a>(std::vector&lt;NTL::ZZX&gt;&amp; x, <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; a, <span class="keywordtype">long</span> b);</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a42185bbb249368e34f515e09e90bc7b0">add</a>(std::vector&lt;NTL::ZZX&gt;&amp; x,</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;         <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; a,</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;         <span class="keyword">const</span> std::vector&lt;NTL::ZZX&gt;&amp; b);</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160; </div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a1249c9ddf12d285f6c06985342e52562">is_in</a>(<span class="keywordtype">long</span> x, <span class="keywordtype">int</span>* X, <span class="keywordtype">long</span> sz);</div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160; </div>
<div class="line"><a name="l00461"></a><span class="lineno"><a class="line" href="namespacehelib.html#afcde52d4dcf5f9f26931c54efa401258">  461</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#afcde52d4dcf5f9f26931c54efa401258">CRTcoeff</a>(<span class="keywordtype">long</span> p, <span class="keywordtype">long</span> q, <span class="keywordtype">bool</span> symmetric = <span class="keyword">false</span>)</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;{</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;  <span class="keywordtype">long</span> pInv = NTL::InvMod(p, q); <span class="comment">// p^-1 mod q \in [0,q)</span></div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;  <span class="keywordflow">if</span> (symmetric &amp;&amp; 2 * pInv &gt;= q)</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;    <span class="keywordflow">return</span> p * (pInv - q);</div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;    <span class="keywordflow">return</span> p * pInv;</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;}</div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160; </div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> zzvec&gt; <span class="comment">// zzvec can be vec_NTL::ZZ, vec_long, or Vec&lt;zz_p&gt;</span></div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#a5165f6a4ea9a752c8c40d5790acfb4e0">intVecCRT</a>(NTL::vec_ZZ&amp; vp, <span class="keyword">const</span> NTL::ZZ&amp; p, <span class="keyword">const</span> zzvec&amp; vq, <span class="keywordtype">long</span> q);</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160; </div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keywordtype">bool</span> maxFlag&gt;</div>
<div class="line"><a name="l00498"></a><span class="lineno"><a class="line" href="namespacehelib.html#aaa88363f3a91a37ba8e213b0cb764ea5">  498</a></span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#aaa88363f3a91a37ba8e213b0cb764ea5">argminmax</a>(std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;{</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;  <span class="keywordflow">if</span> (v.size() &lt; 1)</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;    <span class="keywordflow">return</span> -1; <span class="comment">// error: this is an empty array</span></div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> idx = 0;</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;  T target = v[0];</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i = 1; i &lt; v.size(); i++)</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;    <span class="keywordflow">if</span> (maxFlag) {</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;      <span class="keywordflow">if</span> (v[i] &gt; target) {</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;        target = v[i];</div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;        idx = i;</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;      }</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;      <span class="keywordflow">if</span> (v[i] &lt; target) {</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;        target = v[i];</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;        idx = i;</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;      }</div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;    }</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;  <span class="keywordflow">return</span> (<span class="keywordtype">long</span>)idx;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;}</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160; </div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00520"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae84a9818e92cbee595e4895ad9dee849">  520</a></span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ae84a9818e92cbee595e4895ad9dee849">argmax</a>(std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;{</div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;  <span class="keywordflow">return</span> argminmax&lt;T, true&gt;(v);</div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;}</div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160; </div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00526"></a><span class="lineno"><a class="line" href="namespacehelib.html#a4218a947a483c68d1727c537c216c347">  526</a></span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a4218a947a483c68d1727c537c216c347">argmin</a>(std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;{</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;  <span class="keywordflow">return</span> argminmax&lt;T, false&gt;(v);</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;}</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160; </div>
<div class="line"><a name="l00533"></a><span class="lineno"><a class="line" href="namespacehelib.html#acced988b8c7248219e7c13e20d1d0e6c">  533</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ae84a9818e92cbee595e4895ad9dee849">argmax</a>(std::vector&lt;long&gt;&amp; v, <span class="keywordtype">bool</span> (*moreThan)(<span class="keywordtype">long</span>, <span class="keywordtype">long</span>))</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;{</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;  <span class="keywordflow">if</span> (v.size() &lt; 1)</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;    <span class="keywordflow">return</span> -INT_MAX; <span class="comment">// error: this is an empty array</span></div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> idx = 0;</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;  <span class="keywordtype">long</span> target = v[0];</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i = 1; i &lt; v.size(); i++)</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;    <span class="keywordflow">if</span> ((*moreThan)(v[i], target)) {</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;      target = v[i];</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;      idx = i;</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;    }</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;  <span class="keywordflow">return</span> (<span class="keywordtype">long</span>)idx;</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;}</div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160; </div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;<span class="comment">// Check that x is in 1 += epsilon</span></div>
<div class="line"><a name="l00548"></a><span class="lineno"><a class="line" href="namespacehelib.html#a3b607a9ca070971badf105209dc47583">  548</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#a3b607a9ca070971badf105209dc47583">closeToOne</a>(<span class="keyword">const</span> NTL::xdouble&amp; x, <span class="keywordtype">long</span> p)</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;{</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;  <span class="keywordtype">double</span> pinv = 1.0 / p;</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;  <span class="keywordflow">return</span> (x &lt; (1.0 + pinv) &amp;&amp; x &gt; (1 - pinv));</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;}</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160; </div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;<span class="comment">// Use continued fractions to approximate a float x as x ~ a/b</span></div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;std::pair&lt;long, long&gt; <a class="code" href="namespacehelib.html#a03f697f7ff3bbb3d9d17f75d35946991">rationalApprox</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">long</span> denomBound = 0);</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;std::pair&lt;NTL::ZZ, NTL::ZZ&gt; <a class="code" href="namespacehelib.html#a03f697f7ff3bbb3d9d17f75d35946991">rationalApprox</a>(</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;    NTL::xdouble x,</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    NTL::xdouble denomBound = NTL::xdouble(0.0));</div>
<div class="line"><a name="l00578"></a><span class="lineno"><a class="line" href="classhelib_1_1_random_state.html">  578</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_random_state.html">RandomState</a></div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;{</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  NTL::ZZ state;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;  <span class="keywordtype">bool</span> restored;</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160; </div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00585"></a><span class="lineno"><a class="line" href="classhelib_1_1_random_state.html#a8ef37a5d028c04c6a043da4d019693f4">  585</a></span>&#160;  <a class="code" href="classhelib_1_1_random_state.html#a8ef37a5d028c04c6a043da4d019693f4">RandomState</a>()</div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;  {</div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;    RandomBits(state, 512);</div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;    restored = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;  }</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160; </div>
<div class="line"><a name="l00592"></a><span class="lineno"><a class="line" href="classhelib_1_1_random_state.html#a4b4a43fda7cfa64df83eb9705cd7dc8d">  592</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_random_state.html#a4b4a43fda7cfa64df83eb9705cd7dc8d">restore</a>()</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;  {</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    <span class="keywordflow">if</span> (!restored) {</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;      SetSeed(state);</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;      restored = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;    }</div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;  }</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160; </div>
<div class="line"><a name="l00600"></a><span class="lineno"><a class="line" href="classhelib_1_1_random_state.html#a3d84fe4eca9b472b470358a504e2618e">  600</a></span>&#160;  <a class="code" href="classhelib_1_1_random_state.html#a3d84fe4eca9b472b470358a504e2618e">~RandomState</a>() { <a class="code" href="classhelib_1_1_random_state.html#a4b4a43fda7cfa64df83eb9705cd7dc8d">restore</a>(); }</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160; </div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;  <a class="code" href="classhelib_1_1_random_state.html#a8ef37a5d028c04c6a043da4d019693f4">RandomState</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_random_state.html">RandomState</a>&amp;);            <span class="comment">// disable copy constructor</span></div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;  <a class="code" href="classhelib_1_1_random_state.html">RandomState</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_random_state.html">RandomState</a>&amp;); <span class="comment">// disable assignment</span></div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;};</div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160; </div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a0df3789de0744e7c90d5a5d6cf54a5ed">seekPastChar</a>(std::istream&amp; str, <span class="keywordtype">int</span> cc);</div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160; </div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00613"></a><span class="lineno"><a class="line" href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">  613</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">reverse</a>(NTL::Vec&lt;T&gt;&amp; v, <span class="keywordtype">long</span> lo, <span class="keywordtype">long</span> hi)</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;{</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;  <span class="keywordtype">long</span> n = v.length();</div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;  <a class="code" href="namespacehelib.html#a8e36344202aac3b245f5ba71f69a3e8b">assertInRange</a>(lo, 0l, hi, <span class="stringliteral">&quot;Invalid argument: Bad interval&quot;</span>, <span class="keyword">true</span>);</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;  <a class="code" href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">assertTrue</a>(hi &lt; n, <span class="stringliteral">&quot;Invalid argument: Interval exceeds vector size&quot;</span>);</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160; </div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;  <span class="keywordflow">if</span> (lo &gt;= hi)</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160; </div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = lo, j = hi; i &lt; j; i++, j--)</div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;    <a class="code" href="namespacehelib.html#a16a28125fbbf867ea3394513923a6abb">swap</a>(v[i], v[j]);</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;}</div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160; </div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;<span class="comment">// Example: rotate by 1 means [0 1 2 3] -&gt; [3 0 1 2]</span></div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;<span class="comment">//          rotate by -1 means [0 1 2 3] -&gt; [1 2 3 0]</span></div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00630"></a><span class="lineno"><a class="line" href="namespacehelib.html#a1688528ff1a377be38502ae7c048336c">  630</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a34783d4707b52b8cb0341187d50f8265">rotate</a>(NTL::Vec&lt;T&gt;&amp; v, <span class="keywordtype">long</span> k)</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;{</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;  <span class="keywordtype">long</span> n = v.length();</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;  <span class="keywordflow">if</span> (n &lt;= 1)</div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160; </div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;  k %= n;</div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;  <span class="keywordflow">if</span> (k &lt; 0)</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;    k += n;</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160; </div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;  <span class="keywordflow">if</span> (k == 0)</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160; </div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;  <a class="code" href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">reverse</a>(v, 0, n - 1);</div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;  <a class="code" href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">reverse</a>(v, 0, k - 1);</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;  <a class="code" href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">reverse</a>(v, k, n - 1);</div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;}</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160; </div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;<span class="comment">// An experimental facility...it is annoying that vector::size() is an</span></div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;<span class="comment">// unsigned quantity...this leads to all kinds of annoying warning messages...</span></div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;<span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00652"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">  652</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(<span class="keyword">const</span> std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;{</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;  <span class="keywordflow">return</span> (<span class="keywordtype">long</span>)v.size();</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;}</div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160; </div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160; </div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;<span class="comment">// Utility functions, release memory of std::vector and NTL::Vec</span></div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00661"></a><span class="lineno"><a class="line" href="namespacehelib.html#a3ca37f043534295ce82c13c09b48325f">  661</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3ca37f043534295ce82c13c09b48325f">killVec</a>(std::vector&lt;T&gt;&amp; vec)</div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;{</div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;  std::vector&lt;T&gt;().swap(vec);</div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;}</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00666"></a><span class="lineno"><a class="line" href="namespacehelib.html#a5d98d78d4a4dddc7c6859af409b17e07">  666</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3ca37f043534295ce82c13c09b48325f">killVec</a>(NTL::Vec&lt;T&gt;&amp; vec)</div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;{</div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160;  vec.kill();</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;}</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160; </div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;<span class="comment">// Set length to zero, but don&#39;t necessarily release memory</span></div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00673"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae2de6d470f49ed882f0bde7b67f5c456">  673</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae2de6d470f49ed882f0bde7b67f5c456">setLengthZero</a>(std::vector&lt;T&gt;&amp; vec)</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;{</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;  <span class="keywordflow">if</span> (vec.size() &gt; 0)</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;    vec.resize(0, vec[0]);</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;}</div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00679"></a><span class="lineno"><a class="line" href="namespacehelib.html#a07b53294ce70bc1a04b741ef3ac4512d">  679</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ae2de6d470f49ed882f0bde7b67f5c456">setLengthZero</a>(NTL::Vec&lt;T&gt;&amp; vec)</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;{</div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;  <span class="keywordflow">if</span> (vec.length() &gt; 0)</div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;    vec.SetLength(0, vec[0]);</div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;}</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160; </div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00686"></a><span class="lineno"><a class="line" href="namespacehelib.html#a50cb104179094690467c87a1c09c8a05">  686</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">lsize</a>(<span class="keyword">const</span> NTL::Vec&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;{</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;  <span class="keywordflow">return</span> v.length();</div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;}</div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160; </div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;<span class="comment">// VJS: I changed the resize functions so that the</span></div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;<span class="comment">// optional arg is handled as in C++11</span></div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160; </div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00695"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">  695</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(NTL::Vec&lt;T&gt;&amp; v, <span class="keywordtype">long</span> sz, <span class="keyword">const</span> T&amp; val)</div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;{</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;  <span class="keywordflow">return</span> v.SetLength(sz, val);</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;}</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160; </div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00701"></a><span class="lineno"><a class="line" href="namespacehelib.html#ae8aea4186c17622aa24763219ba2e39c">  701</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(std::vector&lt;T&gt;&amp; v, <span class="keywordtype">long</span> sz, <span class="keyword">const</span> T&amp; val)</div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;{</div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;  <span class="keywordflow">return</span> v.resize(sz, val);</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;}</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160; </div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00707"></a><span class="lineno"><a class="line" href="namespacehelib.html#a49b481e5ebaa9bc469124e7c2d5eae38">  707</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(NTL::Vec&lt;T&gt;&amp; v, <span class="keywordtype">long</span> sz)</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;{</div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;  <span class="keywordflow">return</span> v.SetLength(sz);</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;}</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160; </div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00713"></a><span class="lineno"><a class="line" href="namespacehelib.html#a91e17a6dd739205036bdc410372608cc">  713</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">resize</a>(std::vector&lt;T&gt;&amp; v, <span class="keywordtype">long</span> sz)</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;{</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;  <span class="keywordflow">return</span> v.resize(sz);</div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;}</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160; </div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;<span class="comment">// Believe it or not, this is really the way to do it...</span></div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;</div>
<div class="line"><a name="l00721"></a><span class="lineno"><a class="line" href="namespacehelib.html#a1dac9d465c144cdd7f736730704c38e6">  721</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#a1dac9d465c144cdd7f736730704c38e6">sameObject</a>(<span class="keyword">const</span> T1* p1, <span class="keyword">const</span> T2* p2)</div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;{</div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;  <span class="keywordflow">return</span> <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">void</span>*<span class="keyword">&gt;</span>(p1) == <span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">void</span>*<span class="keyword">&gt;</span>(p2);</div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;}</div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160; </div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ad7d7a435e482d03e39e3b592765adc85">ModComp</a>(NTL::ZZX&amp; res,</div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160;             <span class="keyword">const</span> NTL::ZZX&amp; g,</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;             <span class="keyword">const</span> NTL::ZZX&amp; h,</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;             <span class="keyword">const</span> NTL::ZZX&amp; f);</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160; </div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a11db92e970f97ed66aebb1702dc5a0df">polyEvalMod</a>(<span class="keyword">const</span> NTL::ZZX&amp; poly, <span class="keywordtype">long</span> x, <span class="keywordtype">long</span> p);</div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160; </div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a9e7d6d68a0351702ae31c17eb4e72307">interpolateMod</a>(NTL::ZZX&amp; poly,</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;                    <span class="keyword">const</span> NTL::vec_long&amp; x,</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;                    <span class="keyword">const</span> NTL::vec_long&amp; y,</div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;                    <span class="keywordtype">long</span> p,</div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160;                    <span class="keywordtype">long</span> e = 1);</div>
<div class="line"><a name="l00742"></a><span class="lineno">  742</span>&#160; </div>
<div class="line"><a name="l00744"></a><span class="lineno"><a class="line" href="namespacehelib.html#ad8ff9e17791a3dd96ca79b2dd4d0654d">  744</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#ad8ff9e17791a3dd96ca79b2dd4d0654d">divc</a>(<span class="keywordtype">long</span> a, <span class="keywordtype">long</span> b) { <span class="keywordflow">return</span> (a + b - 1) / b; }</div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160; </div>
<div class="line"><a name="l00749"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html">  749</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1zz__p_x_modulus1.html">zz_pXModulus1</a></div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;{</div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00752"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#afbc0769f9f9ae03d5970d805cff25ba0">  752</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#afbc0769f9f9ae03d5970d805cff25ba0">m</a>;</div>
<div class="line"><a name="l00753"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#a1ab617dddbd62db564723dfa3592f9a5">  753</a></span>&#160;  NTL::zz_pX <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a1ab617dddbd62db564723dfa3592f9a5">f</a>;</div>
<div class="line"><a name="l00754"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#a20d165e749cda8dee52593385ceea9dd">  754</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a20d165e749cda8dee52593385ceea9dd">n</a>;</div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160; </div>
<div class="line"><a name="l00756"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#aee441b0c8f9e8bd527f8cd1f922d6ba4">  756</a></span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#aee441b0c8f9e8bd527f8cd1f922d6ba4">specialLogic</a>;</div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160; </div>
<div class="line"><a name="l00758"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#a5d69f30fd053f9f3a53d3ea38b86f785">  758</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a7b71b83684859b17ba6f7e3f44dd89de">k</a>, <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a5d69f30fd053f9f3a53d3ea38b86f785">k1</a>;</div>
<div class="line"><a name="l00759"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#a58ebc5d435a04560bac26f228b38f2b9">  759</a></span>&#160;  NTL::fftRep <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a5757a8341f74553212f25a5b6f137955">R0</a>, <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a58ebc5d435a04560bac26f228b38f2b9">R1</a>;</div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160; </div>
<div class="line"><a name="l00761"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#a3e1f9e97a7075c01d95b97a73b69195e">  761</a></span>&#160;  NTL::zz_pXModulus <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a3e1f9e97a7075c01d95b97a73b69195e">fm</a>; <span class="comment">// just in case...</span></div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160; </div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;  <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#abc224981ad47dbb515a3c67bc9df5b6d">zz_pXModulus1</a>(<span class="keywordtype">long</span> _m, <span class="keyword">const</span> NTL::zz_pX&amp; _f);</div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160; </div>
<div class="line"><a name="l00765"></a><span class="lineno"><a class="line" href="classhelib_1_1zz__p_x_modulus1.html#aaa98541b58ad4bf14d93a39f26958306">  765</a></span>&#160;  <span class="keyword">const</span> NTL::zz_pXModulus&amp; <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#aaa98541b58ad4bf14d93a39f26958306">upcast</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classhelib_1_1zz__p_x_modulus1.html#a3e1f9e97a7075c01d95b97a73b69195e">fm</a>; }</div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;};</div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160; </div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#af7b15d5fbf553550437df6ca02d5a282">rem</a>(NTL::zz_pX&amp; r, <span class="keyword">const</span> NTL::zz_pX&amp; a, <span class="keyword">const</span> zz_pXModulus1&amp; ff);</div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160; </div>
<div class="line"><a name="l00771"></a><span class="lineno"><a class="line" href="classhelib_1_1_z_z__p_x_modulus1.html">  771</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_z_z__p_x_modulus1.html">ZZ_pXModulus1</a> : <span class="keyword">public</span> NTL::ZZ_pXModulus</div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;{</div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00774"></a><span class="lineno"><a class="line" href="classhelib_1_1_z_z__p_x_modulus1.html#a09894b3405261267bef1e490795f3d95">  774</a></span>&#160;  <a class="code" href="classhelib_1_1_z_z__p_x_modulus1.html#a09894b3405261267bef1e490795f3d95">ZZ_pXModulus1</a>(<a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> _m, <span class="keyword">const</span> NTL::ZZ_pX&amp; _f) : <a class="code" href="namespace_n_t_l.html">NTL</a>::ZZ_pXModulus(_f) {}</div>
<div class="line"><a name="l00775"></a><span class="lineno"><a class="line" href="classhelib_1_1_z_z__p_x_modulus1.html#a6b506809d4188b57d71f0d9ed43c3b6b">  775</a></span>&#160;  <span class="keyword">const</span> NTL::ZZ_pXModulus&amp; <a class="code" href="classhelib_1_1_z_z__p_x_modulus1.html#a6b506809d4188b57d71f0d9ed43c3b6b">upcast</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *<span class="keyword">this</span>; }</div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;};</div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160; </div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00779"></a><span class="lineno"><a class="line" href="namespacehelib.html#a91bd0e83a2e59c7de3a489b5d3fb3aa8">  779</a></span>&#160;std::ostream&amp; <a class="code" href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">operator&lt;&lt;</a>(std::ostream&amp; s, std::vector&lt;T&gt; v)</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;{</div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;  <span class="keywordflow">if</span> (v.size() == 0)</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;    <span class="keywordflow">return</span> (s &lt;&lt; <span class="stringliteral">&quot;[]&quot;</span>);</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160; </div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;  s &lt;&lt; <span class="charliteral">&#39;[&#39;</span>;</div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;  <span class="keywordflow">for</span> (<span class="keywordtype">long</span> i = 0; i &lt; (long)v.size() - 1; i++)</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;    s &lt;&lt; v[i] &lt;&lt; <span class="charliteral">&#39; &#39;</span>;</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;  <span class="keywordflow">return</span> (s &lt;&lt; v[v.size() - 1] &lt;&lt; <span class="charliteral">&#39;]&#39;</span>);</div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;}</div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160; </div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00791"></a><span class="lineno"><a class="line" href="namespacehelib.html#a2b06418a6494e921dec0c5d086cf46ce">  791</a></span>&#160;std::istream&amp; <a class="code" href="namespacehelib.html#a84b37f68c4bdc42558ad0360b00984fb">operator&gt;&gt;</a>(std::istream&amp; s, std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;{</div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;  NTL::Vec&lt;T&gt; vv; <span class="comment">// read into an NTL vector, then convert</span></div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;  s &gt;&gt; vv;</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;  <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v, vv);</div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;  <span class="keywordflow">return</span> s;</div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;}</div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160; </div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00800"></a><span class="lineno"><a class="line" href="namespacehelib.html#aaa86d423a862384884b7bed74e573e8f">  800</a></span>&#160;std::string <a class="code" href="namespacehelib.html#aaa86d423a862384884b7bed74e573e8f">vecToStr</a>(<span class="keyword">const</span> std::vector&lt;T&gt;&amp; v)</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;{</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;  std::stringstream ss;</div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;  ss &lt;&lt; v;</div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;  <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;}</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160; </div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00808"></a><span class="lineno"><a class="line" href="namespacehelib.html#a1040284398724d43661ac3eff7a7400e">  808</a></span>&#160;NTL::Vec&lt;T&gt; <a class="code" href="namespacehelib.html#a1040284398724d43661ac3eff7a7400e">atoVec</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* a)</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;{</div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;  NTL::Vec&lt;T&gt; v;</div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;  std::string s(a);</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;  std::stringstream ss(s);</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;  ss &gt;&gt; v;</div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;  <span class="keywordflow">return</span> v;</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;}</div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160; </div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00818"></a><span class="lineno"><a class="line" href="namespacehelib.html#acdd11aa1bf58d7ac5843fe3ee5fb244c">  818</a></span>&#160;std::vector&lt;T&gt; <a class="code" href="namespacehelib.html#acdd11aa1bf58d7ac5843fe3ee5fb244c">atovector</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* a)</div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;{</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;  NTL::Vec&lt;T&gt; v1 = atoVec&lt;T&gt;(a);</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;  std::vector&lt;T&gt; v2;</div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;  <a class="code" href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">convert</a>(v2, v1);</div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;  <span class="keywordflow">return</span> v2;</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160;}</div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160; </div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;<span class="preprocessor">#ifndef NTL_PROVIDES_TRUNC_FFT</span></div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;<span class="comment">// Define truncated FFT routines if not provided by NTL</span></div>
<div class="line"><a name="l00828"></a><span class="lineno"><a class="line" href="namespacehelib.html#ab19a0354bdc3a0ef4ba47d01c8a4aaaf">  828</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab19a0354bdc3a0ef4ba47d01c8a4aaaf">TofftRep_trunc</a>(NTL::fftRep&amp; y,</div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;                           <span class="keyword">const</span> NTL::zz_pX&amp; x,</div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;                           <span class="keywordtype">long</span> k,</div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;                           <a class="code" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> <span class="keywordtype">long</span> len,</div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;                           <span class="keywordtype">long</span> lo,</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;                           <span class="keywordtype">long</span> hi)</div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;{</div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160;  TofftRep(y, x, k, lo, hi);</div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;}</div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160; </div>
<div class="line"><a name="l00838"></a><span class="lineno"><a class="line" href="namespacehelib.html#a3259e4f89f7c305b12bd13bab812ef72">  838</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab19a0354bdc3a0ef4ba47d01c8a4aaaf">TofftRep_trunc</a>(NTL::fftRep&amp; y,</div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;                           <span class="keyword">const</span> NTL::zz_pX&amp; x,</div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;                           <span class="keywordtype">long</span> k,</div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;                           <span class="keywordtype">long</span> len)</div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;{</div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;  <a class="code" href="namespacehelib.html#ab19a0354bdc3a0ef4ba47d01c8a4aaaf">TofftRep_trunc</a>(y, x, k, len, 0, deg(x));</div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;}</div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160; </div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;<span class="preprocessor">#if 0</span></div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span>... Args&gt;</div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;std::unique_ptr&lt;T&gt; build_unique(Args&amp;&amp;... args)</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;{</div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;    <span class="keywordflow">return</span> std::unique_ptr&lt;T&gt;(<span class="keyword">new</span> T(std::forward&lt;Args&gt;(args)...));</div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;}</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160; </div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> P, <span class="keyword">typename</span>... Args&gt;</div>
<div class="line"><a name="l00860"></a><span class="lineno"><a class="line" href="namespacehelib.html#a454437c5c0e3415fe2a360fa48a3eb5f">  860</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a454437c5c0e3415fe2a360fa48a3eb5f">make_lazy</a>(<span class="keyword">const</span> NTL::Lazy&lt;T, P&gt;&amp; obj, Args&amp;&amp;... args)</div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;{</div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160;  <span class="keyword">typename</span> NTL::Lazy&lt;T, P&gt;::Builder builder(obj);</div>
<div class="line"><a name="l00863"></a><span class="lineno">  863</span>&#160;  <span class="keywordflow">if</span> (!builder())</div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;  NTL::UniquePtr&lt;T, P&gt; ptr;</div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;  ptr.make(std::forward&lt;Args&gt;(args)...);</div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;  builder.move(ptr);</div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;}</div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160; </div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keyword">typename</span> P, <span class="keyword">typename</span> F, <span class="keyword">typename</span>... Args&gt;</div>
<div class="line"><a name="l00874"></a><span class="lineno"><a class="line" href="namespacehelib.html#a05c7ab380349944791e571afd60e7a06">  874</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a05c7ab380349944791e571afd60e7a06">make_lazy_with_fun</a>(<span class="keyword">const</span> NTL::Lazy&lt;T, P&gt;&amp; obj, F f, Args&amp;&amp;... args)</div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;{</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;  <span class="keyword">typename</span> NTL::Lazy&lt;T, P&gt;::Builder builder(obj);</div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;  <span class="keywordflow">if</span> (!builder())</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;    <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;  NTL::UniquePtr&lt;T, P&gt; ptr;</div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;  ptr.make();</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;  f(*ptr, std::forward&lt;Args&gt;(args)...);</div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;  builder.move(ptr);</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;}</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160; </div>
<div class="line"><a name="l00885"></a><span class="lineno"><a class="line" href="namespacehelib.html#a6eafbe78be51b304a8b359f7f6142ef5">  885</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6eafbe78be51b304a8b359f7f6142ef5">Warning</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msg)</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;{</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;  std::cerr &lt;&lt; <span class="stringliteral">&quot;WARNING: &quot;</span> &lt;&lt; msg &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;}</div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160; </div>
<div class="line"><a name="l00890"></a><span class="lineno"><a class="line" href="namespacehelib.html#a9582d8b75aec10d74a0a89b48678be1b">  890</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6eafbe78be51b304a8b359f7f6142ef5">Warning</a>(<span class="keyword">const</span> std::string&amp; msg)</div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;{</div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;  std::cerr &lt;&lt; <span class="stringliteral">&quot;WARNING: &quot;</span> &lt;&lt; msg &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;}</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160; </div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;<span class="comment">// An array of inverse erfc values.</span></div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;<span class="comment">// erfc_inverse[i] = x means 2^{-i} = erfc(x/sqrt(2))</span></div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160; </div>
<div class="line"><a name="l00898"></a><span class="lineno"><a class="line" href="namespacehelib.html#ac088f2fa765a2ab95c318d60df164b6d">  898</a></span>&#160;<span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="namespacehelib.html#ac088f2fa765a2ab95c318d60df164b6d">erfc_inverse</a>[] = {0,</div>
<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;                               0.6744897501960817432,</div>
<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;                               1.1503493803760081782,</div>
<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;                               1.5341205443525463117,</div>
<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160;                               1.8627318674216514554,</div>
<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;                               2.1538746940614562129,</div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;                               2.4175590162365050618,</div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;                               2.6600674686174596585,</div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;                               2.8856349124267571473,</div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;                               3.0972690781987844623,</div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;                               3.2971933456919633418,</div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;                               3.4871041041144311068,</div>
<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;                               3.6683292851213230192,</div>
<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;                               3.8419306855019108708,</div>
<div class="line"><a name="l00912"></a><span class="lineno">  912</span>&#160;                               4.0087725941685849622,</div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;                               4.1695693233491057549,</div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;                               4.3249190408260462571,</div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;                               4.4753284246542033544,</div>
<div class="line"><a name="l00916"></a><span class="lineno">  916</span>&#160;                               4.6212310014992471565,</div>
<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160;                               4.7630010342678139569,</div>
<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;                               4.9009642079631930118};</div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160; </div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;<span class="preprocessor">#define ERFC_INVERSE_SIZE (long(sizeof(erfc_inverse) / sizeof(erfc_inverse[0])))</span></div>
<div class="line"><a name="l00921"></a><span class="lineno"><a class="line" href="_numb_th_8h.html#a71c5778babb7aa5a7caf5e93098b7df4">  921</a></span>&#160; </div>
<div class="line"><a name="l00922"></a><span class="lineno">  922</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00923"></a><span class="lineno">  923</span>&#160; </div>
<div class="line"><a name="l00924"></a><span class="lineno">  924</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_NUMBTH_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespacehelib_html_a9bc3d452674c06b19349e1bfc47cd6bb"><div class="ttname"><a href="namespacehelib.html#a9bc3d452674c06b19349e1bfc47cd6bb">helib::vecRed</a></div><div class="ttdeci">void vecRed(NTL::Vec&lt; NTL::ZZ &gt; &amp;out, const NTL::Vec&lt; NTL::ZZ &gt; &amp;in, long q, bool abs)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:779</div></div>
<div class="ttc" id="anamespacehelib_html_a3b607a9ca070971badf105209dc47583"><div class="ttname"><a href="namespacehelib.html#a3b607a9ca070971badf105209dc47583">helib::closeToOne</a></div><div class="ttdeci">bool closeToOne(const NTL::xdouble &amp;x, long p)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:548</div></div>
<div class="ttc" id="anamespacehelib_html_a5711dacd10c102835bd585bff52e32c5"><div class="ttname"><a href="namespacehelib.html#a5711dacd10c102835bd585bff52e32c5">helib::buildLinPolyCoeffs</a></div><div class="ttdeci">void buildLinPolyCoeffs(NTL::vec_zz_pE &amp;C, const NTL::vec_zz_pE &amp;L, long p, long r)</div><div class="ttdoc">Combination of buildLinPolyMatrix and ppsolve.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1486</div></div>
<div class="ttc" id="anamespacehelib_html_a34783d4707b52b8cb0341187d50f8265"><div class="ttname"><a href="namespacehelib.html#a34783d4707b52b8cb0341187d50f8265">helib::rotate</a></div><div class="ttdeci">void rotate(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, long k)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:763</div></div>
<div class="ttc" id="anamespacehelib_html_ad0bcd83ef1650a094f9ba12551a2e9e4"><div class="ttname"><a href="namespacehelib.html#ad0bcd83ef1650a094f9ba12551a2e9e4">helib::RandPoly</a></div><div class="ttdeci">NTL::ZZX RandPoly(long n, const NTL::ZZ &amp;p)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:705</div></div>
<div class="ttc" id="anamespacehelib_html_a6eafbe78be51b304a8b359f7f6142ef5"><div class="ttname"><a href="namespacehelib.html#a6eafbe78be51b304a8b359f7f6142ef5">helib::Warning</a></div><div class="ttdeci">void Warning(const char *msg)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:885</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a5d69f30fd053f9f3a53d3ea38b86f785"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a5d69f30fd053f9f3a53d3ea38b86f785">helib::zz_pXModulus1::k1</a></div><div class="ttdeci">long k1</div><div class="ttdef"><b>Definition:</b> NumbTh.h:758</div></div>
<div class="ttc" id="anamespacehelib_html_a0cfe07d1b0c2f0e6385f2b6525e0a69b"><div class="ttname"><a href="namespacehelib.html#a0cfe07d1b0c2f0e6385f2b6525e0a69b">helib::mul</a></div><div class="ttdeci">void mul(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1064</div></div>
<div class="ttc" id="anamespacehelib_html_ae8f65ef133cee27ad846423d012d5487"><div class="ttname"><a href="namespacehelib.html#ae8f65ef133cee27ad846423d012d5487">helib::lsize</a></div><div class="ttdeci">long lsize(const std::vector&lt; T &gt; &amp;v)</div><div class="ttdoc">Size of STL vector as a long (rather than unsigned long)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:652</div></div>
<div class="ttc" id="anamespacehelib_html_ad7d7a435e482d03e39e3b592765adc85"><div class="ttname"><a href="namespacehelib.html#ad7d7a435e482d03e39e3b592765adc85">helib::ModComp</a></div><div class="ttdeci">void ModComp(NTL::ZZX &amp;res, const NTL::ZZX &amp;g, const NTL::ZZX &amp;h, const NTL::ZZX &amp;f)</div><div class="ttdoc">Modular composition of polynomials: res = g(h) mod f.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:938</div></div>
<div class="ttc" id="anamespacehelib_html_ad6eb9f0889a704dbc4684ce445c48456"><div class="ttname"><a href="namespacehelib.html#ad6eb9f0889a704dbc4684ce445c48456">helib::LONG</a></div><div class="ttdeci">long LONG</div><div class="ttdef"><b>Definition:</b> NumbTh.h:117</div></div>
<div class="ttc" id="anamespacehelib_html_adad7e0c1723b324e29278f21aa889143"><div class="ttname"><a href="namespacehelib.html#adad7e0c1723b324e29278f21aa889143">helib::makeIrredPoly</a></div><div class="ttdeci">NTL::ZZX makeIrredPoly(long p, long d)</div><div class="ttdoc">Return a degree-d irreducible polynomial mod p.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:101</div></div>
<div class="ttc" id="anamespace_n_t_l_html"><div class="ttname"><a href="namespace_n_t_l.html">NTL</a></div><div class="ttdef"><b>Definition:</b> Test_EvalMap.cpp:13</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a5757a8341f74553212f25a5b6f137955"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a5757a8341f74553212f25a5b6f137955">helib::zz_pXModulus1::R0</a></div><div class="ttdeci">NTL::fftRep R0</div><div class="ttdef"><b>Definition:</b> NumbTh.h:759</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a58ebc5d435a04560bac26f228b38f2b9"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a58ebc5d435a04560bac26f228b38f2b9">helib::zz_pXModulus1::R1</a></div><div class="ttdeci">NTL::fftRep R1</div><div class="ttdef"><b>Definition:</b> NumbTh.h:759</div></div>
<div class="ttc" id="anamespacehelib_1_1_f_h_eglobals_html_ae595d95a946a3f9b5bfbac55e5f0df0f"><div class="ttname"><a href="namespacehelib_1_1_f_h_eglobals.html#ae595d95a946a3f9b5bfbac55e5f0df0f">helib::FHEglobals::automorphVals</a></div><div class="ttdeci">std::set&lt; long &gt; * automorphVals</div><div class="ttdoc">A list of required automorphisms When non-nullptr, causes Ctxt::smartAutomorphism to just record the ...</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:48</div></div>
<div class="ttc" id="anamespacehelib_html_a05c7ab380349944791e571afd60e7a06"><div class="ttname"><a href="namespacehelib.html#a05c7ab380349944791e571afd60e7a06">helib::make_lazy_with_fun</a></div><div class="ttdeci">void make_lazy_with_fun(const NTL::Lazy&lt; T, P &gt; &amp;obj, F f, Args &amp;&amp;... args)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:874</div></div>
<div class="ttc" id="anamespacehelib_html_aca37b5e05bffd4550c995e83594d7325"><div class="ttname"><a href="namespacehelib.html#aca37b5e05bffd4550c995e83594d7325">helib::assertTrue</a></div><div class="ttdeci">void assertTrue(const T &amp;value, const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> assertions.h:61</div></div>
<div class="ttc" id="anamespacehelib_html_a1249c9ddf12d285f6c06985342e52562"><div class="ttname"><a href="namespacehelib.html#a1249c9ddf12d285f6c06985342e52562">helib::is_in</a></div><div class="ttdeci">long is_in(long x, int *X, long sz)</div><div class="ttdoc">Finds whether x is an element of the set X of size sz, Returns -1 it not and the location if true.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:867</div></div>
<div class="ttc" id="anamespacehelib_html_ae977d2527a20cd02ae18841eea99aa2e"><div class="ttname"><a href="namespacehelib.html#ae977d2527a20cd02ae18841eea99aa2e">helib::PolyRed</a></div><div class="ttdeci">void PolyRed(NTL::ZZX &amp;out, const NTL::ZZX &amp;in, long q, bool abs=false)</div><div class="ttdoc">Reduce all the coefficients of a polynomial modulo q.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:749</div></div>
<div class="ttc" id="anamespacehelib_html_ad4d98c1a6634ea3827fafd456ea56a5e"><div class="ttname"><a href="namespacehelib.html#ad4d98c1a6634ea3827fafd456ea56a5e">helib::mobius</a></div><div class="ttdeci">long mobius(long n)</div><div class="ttdoc">Compute mobius function (naive method as n is small).</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:500</div></div>
<div class="ttc" id="aclasshelib_1_1_random_state_html_a8ef37a5d028c04c6a043da4d019693f4"><div class="ttname"><a href="classhelib_1_1_random_state.html#a8ef37a5d028c04c6a043da4d019693f4">helib::RandomState::RandomState</a></div><div class="ttdeci">RandomState()</div><div class="ttdef"><b>Definition:</b> NumbTh.h:585</div></div>
<div class="ttc" id="anamespacehelib_html_a8d163aa9f73ad476ebd97d7778d79258"><div class="ttname"><a href="namespacehelib.html#a8d163aa9f73ad476ebd97d7778d79258">helib::factorize</a></div><div class="ttdeci">void factorize(std::vector&lt; long &gt; &amp;factors, long N)</div><div class="ttdoc">Factoring by trial division, only works for N&lt;2^{60}, only the primes are recorded,...</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:154</div></div>
<div class="ttc" id="anamespacehelib_html_af183ee91810e5601837e62dfb85df0cd"><div class="ttname"><a href="namespacehelib.html#af183ee91810e5601837e62dfb85df0cd">helib::balRem</a></div><div class="ttdeci">long balRem(long a, long q)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:141</div></div>
<div class="ttc" id="anamespacehelib_html_a479ecb7208f177739fa83913e8515192"><div class="ttname"><a href="namespacehelib.html#a479ecb7208f177739fa83913e8515192">helib::recordAutomorphVal2</a></div><div class="ttdeci">void recordAutomorphVal2(long k)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:112</div></div>
<div class="ttc" id="anamespacehelib_html_af7b15d5fbf553550437df6ca02d5a282"><div class="ttname"><a href="namespacehelib.html#af7b15d5fbf553550437df6ca02d5a282">helib::rem</a></div><div class="ttdeci">void rem(NTL::zz_pX &amp;r, const NTL::zz_pX &amp;a, const zz_pXModulus1 &amp;ff)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1737</div></div>
<div class="ttc" id="aclasshelib_1_1_random_state_html_a3d84fe4eca9b472b470358a504e2618e"><div class="ttname"><a href="classhelib_1_1_random_state.html#a3d84fe4eca9b472b470358a504e2618e">helib::RandomState::~RandomState</a></div><div class="ttdeci">~RandomState()</div><div class="ttdef"><b>Definition:</b> NumbTh.h:600</div></div>
<div class="ttc" id="anamespacehelib_html_a1ce92a7a0f311e90d9022ea931a671ec"><div class="ttname"><a href="namespacehelib.html#a1ce92a7a0f311e90d9022ea931a671ec">helib::setAutomorphVals</a></div><div class="ttdeci">void setAutomorphVals(std::set&lt; long &gt; *aVals)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:90</div></div>
<div class="ttc" id="anamespacehelib_html_a784e87216f278000cfa935b61657da58"><div class="ttname"><a href="namespacehelib.html#a784e87216f278000cfa935b61657da58">helib::ppInvert</a></div><div class="ttdeci">void ppInvert(NTL::mat_zz_p &amp;X, const NTL::mat_zz_p &amp;A, long p, long r)</div><div class="ttdoc">Compute the inverse mod p^r of an n x n matrix.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1430</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a1ab617dddbd62db564723dfa3592f9a5"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a1ab617dddbd62db564723dfa3592f9a5">helib::zz_pXModulus1::f</a></div><div class="ttdeci">NTL::zz_pX f</div><div class="ttdef"><b>Definition:</b> NumbTh.h:753</div></div>
<div class="ttc" id="anamespacehelib_html_a8e36344202aac3b245f5ba71f69a3e8b"><div class="ttname"><a href="namespacehelib.html#a8e36344202aac3b245f5ba71f69a3e8b">helib::assertInRange</a></div><div class="ttdeci">void assertInRange(const T &amp;elem, const T &amp;min, const T &amp;max, const std::string &amp;message, bool right_inclusive=false)</div><div class="ttdef"><b>Definition:</b> assertions.h:183</div></div>
<div class="ttc" id="anamespacehelib_html_ad8ff9e17791a3dd96ca79b2dd4d0654d"><div class="ttname"><a href="namespacehelib.html#ad8ff9e17791a3dd96ca79b2dd4d0654d">helib::divc</a></div><div class="ttdeci">long divc(long a, long b)</div><div class="ttdoc">returns ceiling(a/b); assumes a &gt;=0, b&gt;0, a+b &lt;= MAX_LONG</div><div class="ttdef"><b>Definition:</b> NumbTh.h:744</div></div>
<div class="ttc" id="anamespacehelib_html_a3ca37f043534295ce82c13c09b48325f"><div class="ttname"><a href="namespacehelib.html#a3ca37f043534295ce82c13c09b48325f">helib::killVec</a></div><div class="ttdeci">void killVec(std::vector&lt; T &gt; &amp;vec)</div><div class="ttdoc">NTL/std compatibility.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:661</div></div>
<div class="ttc" id="anamespacehelib_html_a9837bdade0e2dabb7bbf0d03a5e2e93b"><div class="ttname"><a href="namespacehelib.html#a9837bdade0e2dabb7bbf0d03a5e2e93b">helib::computeProd</a></div><div class="ttdeci">long computeProd(const NTL::Vec&lt; long &gt; &amp;vec)</div><div class="ttdoc">returns \prod_d vec[d]</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:91</div></div>
<div class="ttc" id="anamespacehelib_html_ac088f2fa765a2ab95c318d60df164b6d"><div class="ttname"><a href="namespacehelib.html#ac088f2fa765a2ab95c318d60df164b6d">helib::erfc_inverse</a></div><div class="ttdeci">const double erfc_inverse[]</div><div class="ttdef"><b>Definition:</b> NumbTh.h:898</div></div>
<div class="ttc" id="anamespacehelib_html_a03f697f7ff3bbb3d9d17f75d35946991"><div class="ttname"><a href="namespacehelib.html#a03f697f7ff3bbb3d9d17f75d35946991">helib::rationalApprox</a></div><div class="ttdeci">std::pair&lt; long, long &gt; rationalApprox(double x, long denomBound=0)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1573</div></div>
<div class="ttc" id="anamespacehelib_html_a9b5c3e6a25c84bcec39b646e10598378"><div class="ttname"><a href="namespacehelib.html#a9b5c3e6a25c84bcec39b646e10598378">helib::primroot</a></div><div class="ttdeci">long primroot(long N, long phiN)</div><div class="ttdoc">Find a primitive root modulo N.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:671</div></div>
<div class="ttc" id="anamespacehelib_html_a8693a4a2d91babebc9b8887bbcd1f0ea"><div class="ttname"><a href="namespacehelib.html#a8693a4a2d91babebc9b8887bbcd1f0ea">helib::ord</a></div><div class="ttdeci">long ord(long N, long p)</div><div class="ttdoc">Compute the highest power of p that divides N.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:695</div></div>
<div class="ttc" id="anamespacehelib_html_aaa88363f3a91a37ba8e213b0cb764ea5"><div class="ttname"><a href="namespacehelib.html#aaa88363f3a91a37ba8e213b0cb764ea5">helib::argminmax</a></div><div class="ttdeci">long argminmax(std::vector&lt; T &gt; &amp;v)</div><div class="ttdoc">Find the index of the (first) largest/smallest element.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:498</div></div>
<div class="ttc" id="anamespacehelib_html_a3f2638750d81a618d59217f3e9b3218a"><div class="ttname"><a href="namespacehelib.html#a3f2638750d81a618d59217f3e9b3218a">helib::mcMod</a></div><div class="ttdeci">long mcMod(long a, long b)</div><div class="ttdoc">Routines for computing mathematically correct mod and div.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:44</div></div>
<div class="ttc" id="anamespacehelib_html_af6cd0b7c9b7fa0afbb885295f10d9354"><div class="ttname"><a href="namespacehelib.html#af6cd0b7c9b7fa0afbb885295f10d9354">helib::bitSetToLong</a></div><div class="ttdeci">long bitSetToLong(long bits, long bitSize)</div><div class="ttdoc">Considers bits as a vector of bits and returns the value it represents when interpreted as a n-bit 2'...</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:31</div></div>
<div class="ttc" id="anamespacehelib_html_a9965244b44a7884f3e08999f6adec16f"><div class="ttname"><a href="namespacehelib.html#a9965244b44a7884f3e08999f6adec16f">helib::div</a></div><div class="ttdeci">void div(std::vector&lt; NTL::ZZX &gt; &amp;x, const std::vector&lt; NTL::ZZX &gt; &amp;a, long b)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1202</div></div>
<div class="ttc" id="anamespacehelib_html_a8fab1809e50aa6fc8c0f80e66943f490"><div class="ttname"><a href="namespacehelib.html#a8fab1809e50aa6fc8c0f80e66943f490">helib::setAutomorphVals2</a></div><div class="ttdeci">void setAutomorphVals2(std::set&lt; long &gt; *aVals)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:102</div></div>
<div class="ttc" id="anamespacehelib_html_af8f51eef1d124d7e046b6a276d857fdb"><div class="ttname"><a href="namespacehelib.html#af8f51eef1d124d7e046b6a276d857fdb">helib::setDryRun</a></div><div class="ttdeci">bool setDryRun(bool toWhat=true)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:83</div></div>
<div class="ttc" id="anamespacehelib_html_aff7fd713547b09f8f18fbf95ccf83f95"><div class="ttname"><a href="namespacehelib.html#aff7fd713547b09f8f18fbf95ccf83f95">helib::isSetAutomorphVals2</a></div><div class="ttdeci">bool isSetAutomorphVals2()</div><div class="ttdef"><b>Definition:</b> NumbTh.h:107</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_aaa98541b58ad4bf14d93a39f26958306"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#aaa98541b58ad4bf14d93a39f26958306">helib::zz_pXModulus1::upcast</a></div><div class="ttdeci">const NTL::zz_pXModulus &amp; upcast() const</div><div class="ttdef"><b>Definition:</b> NumbTh.h:765</div></div>
<div class="ttc" id="anamespacehelib_html_a9e7d6d68a0351702ae31c17eb4e72307"><div class="ttname"><a href="namespacehelib.html#a9e7d6d68a0351702ae31c17eb4e72307">helib::interpolateMod</a></div><div class="ttdeci">void interpolateMod(NTL::ZZX &amp;poly, const NTL::vec_long &amp;x, const NTL::vec_long &amp;y, long p, long e=1)</div><div class="ttdoc">Interpolate polynomial such that poly(x[i] mod p)=y[i] (mod p^e) It is assumed that the points x[i] a...</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1017</div></div>
<div class="ttc" id="aclasshelib_1_1_z_z__p_x_modulus1_html_a6b506809d4188b57d71f0d9ed43c3b6b"><div class="ttname"><a href="classhelib_1_1_z_z__p_x_modulus1.html#a6b506809d4188b57d71f0d9ed43c3b6b">helib::ZZ_pXModulus1::upcast</a></div><div class="ttdeci">const NTL::ZZ_pXModulus &amp; upcast() const</div><div class="ttdef"><b>Definition:</b> NumbTh.h:775</div></div>
<div class="ttc" id="anamespacehelib_html_a3f11bbe3deab00c9a1dc525d23958a6c"><div class="ttname"><a href="namespacehelib.html#a3f11bbe3deab00c9a1dc525d23958a6c">helib::vector_replicate</a></div><div class="ttdeci">std::vector&lt; T &gt; vector_replicate(const T &amp;a, long n)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:425</div></div>
<div class="ttc" id="anamespacehelib_html_aaa86d423a862384884b7bed74e573e8f"><div class="ttname"><a href="namespacehelib.html#aaa86d423a862384884b7bed74e573e8f">helib::vecToStr</a></div><div class="ttdeci">std::string vecToStr(const std::vector&lt; T &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:800</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a20d165e749cda8dee52593385ceea9dd"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a20d165e749cda8dee52593385ceea9dd">helib::zz_pXModulus1::n</a></div><div class="ttdeci">long n</div><div class="ttdef"><b>Definition:</b> NumbTh.h:754</div></div>
<div class="ttc" id="anamespacehelib_html_a5165f6a4ea9a752c8c40d5790acfb4e0"><div class="ttname"><a href="namespacehelib.html#a5165f6a4ea9a752c8c40d5790acfb4e0">helib::intVecCRT</a></div><div class="ttdeci">bool intVecCRT(NTL::vec_ZZ &amp;vp, const NTL::ZZ &amp;p, const zzvec &amp;vq, long q)</div><div class="ttdoc">Incremental integer CRT for vectors.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:892</div></div>
<div class="ttc" id="anamespacehelib_html_a8fc507c5ea1850c348a7c2d743b59a57"><div class="ttname"><a href="namespacehelib.html#a8fc507c5ea1850c348a7c2d743b59a57">helib::MulMod</a></div><div class="ttdeci">void MulMod(NTL::ZZX &amp;out, const NTL::ZZX &amp;f, long a, long q, bool abs)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:829</div></div>
<div class="ttc" id="anamespacehelib_html_ae2de6d470f49ed882f0bde7b67f5c456"><div class="ttname"><a href="namespacehelib.html#ae2de6d470f49ed882f0bde7b67f5c456">helib::setLengthZero</a></div><div class="ttdeci">void setLengthZero(std::vector&lt; T &gt; &amp;vec)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:673</div></div>
<div class="ttc" id="anamespacehelib_html_a1040284398724d43661ac3eff7a7400e"><div class="ttname"><a href="namespacehelib.html#a1040284398724d43661ac3eff7a7400e">helib::atoVec</a></div><div class="ttdeci">NTL::Vec&lt; T &gt; atoVec(const char *a)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:808</div></div>
<div class="ttc" id="anamespacehelib_html_a93e575c4502d7606d86b46af66600ce0"><div class="ttname"><a href="namespacehelib.html#a93e575c4502d7606d86b46af66600ce0">helib::phi_N</a></div><div class="ttdeci">long phi_N(long N)</div><div class="ttdoc">Compute Phi(N).</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:233</div></div>
<div class="ttc" id="aapi_attributes_8h_html_addf5ec070e9499d36b7f2009ce736076"><div class="ttname"><a href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a></div><div class="ttdeci">#define UNUSED</div><div class="ttdef"><b>Definition:</b> apiAttributes.h:31</div></div>
<div class="ttc" id="anamespacehelib_html_ad61eac49543dd3559b386f94ca7112c9"><div class="ttname"><a href="namespacehelib.html#ad61eac49543dd3559b386f94ca7112c9">helib::resize</a></div><div class="ttdeci">void resize(NTL::Vec&lt; T &gt; &amp;v, long sz, const T &amp;val)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:695</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html">helib::zz_pXModulus1</a></div><div class="ttdoc">Auxiliary classes to facilitate faster reduction mod Phi_m(X) when the input has degree less than m.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:750</div></div>
<div class="ttc" id="arange_8h_html"><div class="ttname"><a href="range_8h.html">range.h</a></div></div>
<div class="ttc" id="anamespacehelib_html_a454437c5c0e3415fe2a360fa48a3eb5f"><div class="ttname"><a href="namespacehelib.html#a454437c5c0e3415fe2a360fa48a3eb5f">helib::make_lazy</a></div><div class="ttdeci">void make_lazy(const NTL::Lazy&lt; T, P &gt; &amp;obj, Args &amp;&amp;... args)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:860</div></div>
<div class="ttc" id="anamespacehelib_html_a51f60e27cb24d575d4b10a522dbb4279"><div class="ttname"><a href="namespacehelib.html#a51f60e27cb24d575d4b10a522dbb4279">helib::mcDiv</a></div><div class="ttdeci">long mcDiv(long a, long b)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:54</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="anamespacehelib_html_add32ec15c61473a42b7136dee8360b8b"><div class="ttname"><a href="namespacehelib.html#add32ec15c61473a42b7136dee8360b8b">helib::phiN</a></div><div class="ttdeci">void phiN(long &amp;phiN, std::vector&lt; long &gt; &amp;facts, long N)</div><div class="ttdoc">Compute Phi(N) and also factorize N.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:226</div></div>
<div class="ttc" id="anamespacehelib_html_acdb8f2124f5f56970fe7f88802c976b1"><div class="ttname"><a href="namespacehelib.html#acdb8f2124f5f56970fe7f88802c976b1">helib::ppsolve</a></div><div class="ttdeci">void ppsolve(NTL::vec_zz_pE &amp;x, const NTL::mat_zz_pE &amp;A, const NTL::vec_zz_pE &amp;b, long p, long r)</div><div class="ttdoc">Prime power solver.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1226</div></div>
<div class="ttc" id="aapi_attributes_8h_html"><div class="ttname"><a href="api_attributes_8h.html">apiAttributes.h</a></div></div>
<div class="ttc" id="aclasshelib_1_1_random_state_html_a4b4a43fda7cfa64df83eb9705cd7dc8d"><div class="ttname"><a href="classhelib_1_1_random_state.html#a4b4a43fda7cfa64df83eb9705cd7dc8d">helib::RandomState::restore</a></div><div class="ttdeci">void restore()</div><div class="ttdoc">Restore the PRG state of NTL.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:592</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_abc224981ad47dbb515a3c67bc9df5b6d"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#abc224981ad47dbb515a3c67bc9df5b6d">helib::zz_pXModulus1::zz_pXModulus1</a></div><div class="ttdeci">zz_pXModulus1(long _m, const NTL::zz_pX &amp;_f)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1711</div></div>
<div class="ttc" id="anamespacehelib_html_aa79a0a06add60a27a1a2198fcf948e01"><div class="ttname"><a href="namespacehelib.html#aa79a0a06add60a27a1a2198fcf948e01">helib::isDryRun</a></div><div class="ttdeci">bool isDryRun()</div><div class="ttdef"><b>Definition:</b> NumbTh.h:88</div></div>
<div class="ttc" id="anamespacehelib_html_a00e504f2374c5e7357c7608a94527887"><div class="ttname"><a href="namespacehelib.html#a00e504f2374c5e7357c7608a94527887">helib::balanced_MulMod</a></div><div class="ttdeci">void balanced_MulMod(NTL::ZZX &amp;out, const NTL::ZZX &amp;f, long a, long q)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:850</div></div>
<div class="ttc" id="anamespacehelib_html_a96fc760be384a17313e24f5383ceabd1"><div class="ttname"><a href="namespacehelib.html#a96fc760be384a17313e24f5383ceabd1">helib::multOrd</a></div><div class="ttdeci">long multOrd(long p, long m)</div><div class="ttdoc">Return multiplicative order of p modulo m, or 0 if GCD(p, m) != 1.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:67</div></div>
<div class="ttc" id="anamespacehelib_html_a1dac9d465c144cdd7f736730704c38e6"><div class="ttname"><a href="namespacehelib.html#a1dac9d465c144cdd7f736730704c38e6">helib::sameObject</a></div><div class="ttdeci">bool sameObject(const T1 *p1, const T2 *p2)</div><div class="ttdoc">Testing if two vectors point to the same object.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:721</div></div>
<div class="ttc" id="anamespacehelib_html_ac1630d15e5b8352685afcf561db40323"><div class="ttname"><a href="namespacehelib.html#ac1630d15e5b8352685afcf561db40323">helib::log2</a></div><div class="ttdeci">double log2(const NTL::xdouble &amp;x)</div><div class="ttdoc">Base-2 logarithm.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:237</div></div>
<div class="ttc" id="anamespacehelib_html_addc58993c7093dd07d98335bab200e82"><div class="ttname"><a href="namespacehelib.html#addc58993c7093dd07d98335bab200e82">helib::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;s, const SKHandle &amp;handle)</div><div class="ttdef"><b>Definition:</b> Ctxt.h:189</div></div>
<div class="ttc" id="anamespacehelib_html_a0df3789de0744e7c90d5a5d6cf54a5ed"><div class="ttname"><a href="namespacehelib.html#a0df3789de0744e7c90d5a5d6cf54a5ed">helib::seekPastChar</a></div><div class="ttdeci">void seekPastChar(std::istream &amp;str, int cc)</div><div class="ttdoc">Advance the input stream beyond white spaces and a single instance of the char cc.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1046</div></div>
<div class="ttc" id="aclasshelib_1_1_random_state_html"><div class="ttname"><a href="classhelib_1_1_random_state.html">helib::RandomState</a></div><div class="ttdoc">Facility for &quot;restoring&quot; the NTL PRG state.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:579</div></div>
<div class="ttc" id="anamespacehelib_html_aa4e11abf6db9206e9dc7ac9397ce28fb"><div class="ttname"><a href="namespacehelib.html#aa4e11abf6db9206e9dc7ac9397ce28fb">helib::PI</a></div><div class="ttdeci">const long double PI</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:23</div></div>
<div class="ttc" id="anamespacehelib_html_a407ad6533d4dd3820cc35b07ad41988b"><div class="ttname"><a href="namespacehelib.html#a407ad6533d4dd3820cc35b07ad41988b">helib::pp_factorize</a></div><div class="ttdeci">void pp_factorize(std::vector&lt; long &gt; &amp;factors, long N)</div><div class="ttdoc">Prime-power factorization.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:201</div></div>
<div class="ttc" id="anamespacehelib_html_ae84a9818e92cbee595e4895ad9dee849"><div class="ttname"><a href="namespacehelib.html#ae84a9818e92cbee595e4895ad9dee849">helib::argmax</a></div><div class="ttdeci">long argmax(std::vector&lt; T &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:520</div></div>
<div class="ttc" id="anamespacehelib_html_acdd11aa1bf58d7ac5843fe3ee5fb244c"><div class="ttname"><a href="namespacehelib.html#acdd11aa1bf58d7ac5843fe3ee5fb244c">helib::atovector</a></div><div class="ttdeci">std::vector&lt; T &gt; atovector(const char *a)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:818</div></div>
<div class="ttc" id="anamespacehelib_1_1_f_h_eglobals_html_a59a5014a165318cfdf6dd1ba9044e9e3"><div class="ttname"><a href="namespacehelib_1_1_f_h_eglobals.html#a59a5014a165318cfdf6dd1ba9044e9e3">helib::FHEglobals::dryRun</a></div><div class="ttdeci">bool dryRun</div><div class="ttdoc">A dry-run flag The dry-run option disables most operations, to save time. This lets us quickly go ove...</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:26</div></div>
<div class="ttc" id="anamespacehelib_html_a4218a947a483c68d1727c537c216c347"><div class="ttname"><a href="namespacehelib.html#a4218a947a483c68d1727c537c216c347">helib::argmin</a></div><div class="ttdeci">long argmin(std::vector&lt; T &gt; &amp;v)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:526</div></div>
<div class="ttc" id="anamespacehelib_html_a9e1f9936cf8c582202702cbb65eaf2ce"><div class="ttname"><a href="namespacehelib.html#a9e1f9936cf8c582202702cbb65eaf2ce">helib::FindPrimitiveRoot</a></div><div class="ttdeci">void FindPrimitiveRoot(NTL::zz_p &amp;r, unsigned long e)</div><div class="ttdoc">Find e-th root of unity modulo the current modulus.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:490</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a7b71b83684859b17ba6f7e3f44dd89de"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a7b71b83684859b17ba6f7e3f44dd89de">helib::zz_pXModulus1::k</a></div><div class="ttdeci">long k</div><div class="ttdef"><b>Definition:</b> NumbTh.h:758</div></div>
<div class="ttc" id="anamespacehelib_html_a0dda3f81ff66fb0e9a92bc39ecad0a92"><div class="ttname"><a href="namespacehelib.html#a0dda3f81ff66fb0e9a92bc39ecad0a92">helib::applyLinPoly</a></div><div class="ttdeci">void applyLinPoly(NTL::zz_pE &amp;beta, const NTL::vec_zz_pE &amp;C, const NTL::zz_pE &amp;alpha, long p)</div><div class="ttdoc">Apply a linearized polynomial with coefficient vector C.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1526</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_afbc0769f9f9ae03d5970d805cff25ba0"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#afbc0769f9f9ae03d5970d805cff25ba0">helib::zz_pXModulus1::m</a></div><div class="ttdeci">long m</div><div class="ttdef"><b>Definition:</b> NumbTh.h:752</div></div>
<div class="ttc" id="anamespacehelib_html_afcde52d4dcf5f9f26931c54efa401258"><div class="ttname"><a href="namespacehelib.html#afcde52d4dcf5f9f26931c54efa401258">helib::CRTcoeff</a></div><div class="ttdeci">long CRTcoeff(long p, long q, bool symmetric=false)</div><div class="ttdoc">Returns a CRT coefficient: x = (0 mod p, 1 mod q). If symmetric is set then x \in [-pq/2,...</div><div class="ttdef"><b>Definition:</b> NumbTh.h:461</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_a3e1f9e97a7075c01d95b97a73b69195e"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#a3e1f9e97a7075c01d95b97a73b69195e">helib::zz_pXModulus1::fm</a></div><div class="ttdeci">NTL::zz_pXModulus fm</div><div class="ttdef"><b>Definition:</b> NumbTh.h:761</div></div>
<div class="ttc" id="anamespacehelib_html_a181a74dc451ffc410450d6c238f2a68c"><div class="ttname"><a href="namespacehelib.html#a181a74dc451ffc410450d6c238f2a68c">helib::Cyclotomic</a></div><div class="ttdeci">NTL::ZZX Cyclotomic(long N)</div><div class="ttdoc">Compute cyclotomic polynomial.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:529</div></div>
<div class="ttc" id="anamespacehelib_html_a42185bbb249368e34f515e09e90bc7b0"><div class="ttname"><a href="namespacehelib.html#a42185bbb249368e34f515e09e90bc7b0">helib::add</a></div><div class="ttdeci">void add(const EncryptedArray &amp;ea, PlaintextArray &amp;pa, const PlaintextArray &amp;other)</div><div class="ttdef"><b>Definition:</b> EncryptedArray.cpp:1008</div></div>
<div class="ttc" id="anamespacehelib_html_ad92538fab792f75e009a2330c365637d"><div class="ttname"><a href="namespacehelib.html#ad92538fab792f75e009a2330c365637d">helib::fsquare</a></div><div class="ttdeci">double fsquare(double x)</div><div class="ttdoc">Return the square of a number as a double.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:150</div></div>
<div class="ttc" id="anamespacehelib_html_af5a79c25bb9e1285c93b486ce07c4d52"><div class="ttname"><a href="namespacehelib.html#af5a79c25bb9e1285c93b486ce07c4d52">helib::conv</a></div><div class="ttdeci">void conv(DoubleCRT &amp;d, const NTL::ZZX &amp;p)</div><div class="ttdef"><b>Definition:</b> DoubleCRT.h:403</div></div>
<div class="ttc" id="anamespacehelib_html_a16a28125fbbf867ea3394513923a6abb"><div class="ttname"><a href="namespacehelib.html#a16a28125fbbf867ea3394513923a6abb">helib::swap</a></div><div class="ttdeci">void swap(cloned_ptr&lt; X, Cloner &gt; &amp;x, cloned_ptr&lt; X, Cloner &gt; &amp;y)</div><div class="ttdef"><b>Definition:</b> clonedPtr.h:170</div></div>
<div class="ttc" id="anamespacehelib_html_ab19a0354bdc3a0ef4ba47d01c8a4aaaf"><div class="ttname"><a href="namespacehelib.html#ab19a0354bdc3a0ef4ba47d01c8a4aaaf">helib::TofftRep_trunc</a></div><div class="ttdeci">void TofftRep_trunc(NTL::fftRep &amp;y, const NTL::zz_pX &amp;x, long k, UNUSED long len, long lo, long hi)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:828</div></div>
<div class="ttc" id="anamespacehelib_1_1_f_h_eglobals_html_a26e09dcf2db94c4039eb189a76a803ee"><div class="ttname"><a href="namespacehelib_1_1_f_h_eglobals.html#a26e09dcf2db94c4039eb189a76a803ee">helib::FHEglobals::automorphVals2</a></div><div class="ttdeci">std::set&lt; long &gt; * automorphVals2</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:49</div></div>
<div class="ttc" id="anamespacehelib_html_ac639ce6687180f2ac5e50e8706d79488"><div class="ttname"><a href="namespacehelib.html#ac639ce6687180f2ac5e50e8706d79488">helib::isSetAutomorphVals</a></div><div class="ttdeci">bool isSetAutomorphVals()</div><div class="ttdef"><b>Definition:</b> NumbTh.h:95</div></div>
<div class="ttc" id="aclasshelib_1_1zz__p_x_modulus1_html_aee441b0c8f9e8bd527f8cd1f922d6ba4"><div class="ttname"><a href="classhelib_1_1zz__p_x_modulus1.html#aee441b0c8f9e8bd527f8cd1f922d6ba4">helib::zz_pXModulus1::specialLogic</a></div><div class="ttdeci">bool specialLogic</div><div class="ttdef"><b>Definition:</b> NumbTh.h:756</div></div>
<div class="ttc" id="anamespacehelib_html_a7db28e5ca105b114e0c89655eee171b9"><div class="ttname"><a href="namespacehelib.html#a7db28e5ca105b114e0c89655eee171b9">helib::buildLinPolyMatrix</a></div><div class="ttdeci">void buildLinPolyMatrix(NTL::mat_zz_pE &amp;M, long p)</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:1071</div></div>
<div class="ttc" id="aclasshelib_1_1_z_z__p_x_modulus1_html"><div class="ttname"><a href="classhelib_1_1_z_z__p_x_modulus1.html">helib::ZZ_pXModulus1</a></div><div class="ttdoc">placeholder for pXModulus ...no optimizations</div><div class="ttdef"><b>Definition:</b> NumbTh.h:772</div></div>
<div class="ttc" id="anamespacehelib_html_a84b37f68c4bdc42558ad0360b00984fb"><div class="ttname"><a href="namespacehelib.html#a84b37f68c4bdc42558ad0360b00984fb">helib::operator&gt;&gt;</a></div><div class="ttdeci">std::istream &amp; operator&gt;&gt;(std::istream &amp;s, CtxtPart &amp;p)</div><div class="ttdef"><b>Definition:</b> Ctxt.cpp:1882</div></div>
<div class="ttc" id="anamespacehelib_html_a877d5bbaf6ad7ef25042c6711e6a6aa2"><div class="ttname"><a href="namespacehelib.html#a877d5bbaf6ad7ef25042c6711e6a6aa2">helib::convert</a></div><div class="ttdeci">void convert(long &amp;x1, const NTL::GF2X &amp;x2)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:358</div></div>
<div class="ttc" id="anamespacehelib_html_a11db92e970f97ed66aebb1702dc5a0df"><div class="ttname"><a href="namespacehelib.html#a11db92e970f97ed66aebb1702dc5a0df">helib::polyEvalMod</a></div><div class="ttdeci">long polyEvalMod(const NTL::ZZX &amp;poly, long x, long p)</div><div class="ttdoc">Evaluates a modular integer polynomial, returns poly(x) mod p.</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:956</div></div>
<div class="ttc" id="aclasshelib_1_1_z_z__p_x_modulus1_html_a09894b3405261267bef1e490795f3d95"><div class="ttname"><a href="classhelib_1_1_z_z__p_x_modulus1.html#a09894b3405261267bef1e490795f3d95">helib::ZZ_pXModulus1::ZZ_pXModulus1</a></div><div class="ttdeci">ZZ_pXModulus1(UNUSED long _m, const NTL::ZZ_pX &amp;_f)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:774</div></div>
<div class="ttc" id="anamespacehelib_html_a29ccc2648ee5736fe519c1c884bf1b68"><div class="ttname"><a href="namespacehelib.html#a29ccc2648ee5736fe519c1c884bf1b68">helib::Vec_replicate</a></div><div class="ttdeci">std::vector&lt; T &gt; Vec_replicate(const T &amp;a, long n)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:435</div></div>
<div class="ttc" id="anamespacehelib_html_a8dfd59b19280a7a98989bbc0dd6a8c2c"><div class="ttname"><a href="namespacehelib.html#a8dfd59b19280a7a98989bbc0dd6a8c2c">helib::reverse</a></div><div class="ttdeci">void reverse(NTL::Vec&lt; T &gt; &amp;v, long lo, long hi)</div><div class="ttdoc">Reverse a vector in place.</div><div class="ttdef"><b>Definition:</b> NumbTh.h:613</div></div>
<div class="ttc" id="anamespacehelib_html_a57dbaa8bc9cf194a1e08fd5af3497a5e"><div class="ttname"><a href="namespacehelib.html#a57dbaa8bc9cf194a1e08fd5af3497a5e">helib::is2power</a></div><div class="ttdeci">bool is2power(long m)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:285</div></div>
<div class="ttc" id="aassertions_8h_html"><div class="ttname"><a href="assertions_8h.html">assertions.h</a></div><div class="ttdoc">Various assertion functions for use within HElib. These are meant as a replacement for C-style assert...</div></div>
<div class="ttc" id="anamespacehelib_html_a67f0037687252f6999a8526165cd8e41"><div class="ttname"><a href="namespacehelib.html#a67f0037687252f6999a8526165cd8e41">helib::findGenerators</a></div><div class="ttdeci">long findGenerators(std::vector&lt; long &gt; &amp;gens, std::vector&lt; long &gt; &amp;ords, long m, long p, const std::vector&lt; long &gt; &amp;candidates=std::vector&lt; long &gt;())</div><div class="ttdef"><b>Definition:</b> NumbTh.cpp:340</div></div>
<div class="ttc" id="anamespacehelib_html_a7b0cf6b325974c5fb87c29686d82e414"><div class="ttname"><a href="namespacehelib.html#a7b0cf6b325974c5fb87c29686d82e414">helib::recordAutomorphVal</a></div><div class="ttdeci">void recordAutomorphVal(long k)</div><div class="ttdef"><b>Definition:</b> NumbTh.h:100</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
